import React from "react";
import {BrowserRouter, Routes, Route, Navigate} from "react-router-dom";

import Top from "../component/Top";

import Page1 from "./Page1";
import Page2 from "./Page2";
import Page3 from "./Page3";

export default function Root(){
    return <BrowserRouter>
        <Top />
        <Routes>
            <Route path="/page1" element={<Page1 />} />
            <Route path="/page2" element={<Page2 />} />
            <Route path="/page3" element={<Page3 />} />
            <Route path="*" element={<Navigate to="/page1" replace />} />
        </Routes>
    </BrowserRouter>;
}

//  关于ReactRouter v6
//  https://reacttraining.com/blog/react-router-v6-pre/
//
